<h1><%=h 'Fandoms'.t %></h1>
<ol>
<%- @fandom_listing.each do |pair| -%>
  <% if pair[0] %>
    <li id="medium_<%= pair[0].id %>" class="category <%= cycle :odd, :even %>">
      <h2><%= link_to pair[0].name, medium_path(pair[0]) %></h2>
  <% else %>
    <li id="medium_none" class="category <%= cycle :odd, :even %>">
      <h2><%= link_to "Uncategorized Fandoms".t, medium_path(:id => 0) %></h2>
  <% end %>
    <ol>
    <% 5.times do |i| %>
    <% fandom = pair[1].sort_by(&:visible_works_count).reverse[i] %>
    <% if fandom && fandom.visible_works_count > 0 %>
      <li><%= link_to fandom.name + " (" + fandom.visible_works_count.to_s + ")", tag_works_path(fandom) %></li>
      <%- end -%>
      <%- end -%>
    </ol>

    <%- if pair[0] && (pair[1].size > 5 )-%>
    <p><%= link_to "All".t + ' ' + pair[0].name + "...", medium_path(pair[0]) %></p>
    <%- end -%>
  </li>
<%- end -%>
</ol>
